import { SAVE_CHANNELS, UPDATE_CURRENT_ID } from '../action/actionType';

const initialState = {
  list: [],
  currentId: 0,
};

export default function channelReducer(state = initialState, { type, payload }) {
  switch (type) {
    case SAVE_CHANNELS:
      return {
        ...state,
        list: payload,
      };

    case UPDATE_CURRENT_ID:
      return {
        ...state,
        currentId: payload,
      };
    default:
      return state;
  }
}
